//
//  BTEMeTopTableViewCell.swift
//  BTE
//
//  Created by Mike Zhang on 2025/8/21.
//

import UIKit

class BTEMeTopTableViewCell: UITableViewCell {
    
    private let topBox = UIView()
    
    let iconv = UIImageView.init(image: UIImage.init(named: "image1111111111"))
    
    let phone = UILabel.init()
    
    let fixla = UILabel.init()
    
    let imgeee = UIImageView.init(image: UIImage.init(named: BTELanguageManager.shared.localizedImageString(forKey: "Group 1171277340")))
    
    let abt = UILabel()

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        selectionStyle = .none
        
        backgroundColor = .clear
        contentView.backgroundColor = .clear
        
        contentView.addSubview(topBox)
        topBox.roundCorners([.topLeft,.bottomLeft,.bottomRight], radius: 18)
        topBox.backgroundColor = .white
        topBox.layer.borderColor = UIColor.colorWithHex("#6C2724")!.cgColor
        topBox.layer.borderWidth = 2
        topBox.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(17)
            make.top.equalToSuperview().offset(20)
        }
        
        topBox.addSubview(iconv)
        iconv.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(12)
            make.top.equalToSuperview().offset(20)
            make.width.height.equalTo(56)
        }
        
        phone.textColor = .black
        phone.font = .systemFont(ofSize: 20, weight: .semibold)
        topBox.addSubview(phone)
        phone.snp.makeConstraints { make in
            make.left.equalTo(iconv.snp.right).offset(6)
            make.top.equalTo(iconv.snp.top).offset(5)
        }
        
        fixla.text = BTELanguageManager.shared.localizedString(forKey: "Hello! Welcome to Pinjaman Instan!")
        fixla.font = .systemFont(ofSize: 12)
        topBox.addSubview(fixla)
        fixla.snp.makeConstraints { make in
            make.left.equalTo(iconv.snp.right).offset(6)
            make.top.equalTo(phone.snp.bottom).offset(8)
        }
        
      
        topBox.addSubview(imgeee)
        imgeee.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(15)
            make.top.equalTo(iconv.snp.bottom).offset(16)
            make.bottom.equalToSuperview().offset(-20)
        }
        
        abt.textColor = .black
        abt.text = BTELanguageManager.shared.localizedString(forKey: "My functions")
        abt.font = .systemFont(ofSize: 18, weight: .bold)
        contentView.addSubview(abt)
        abt.snp.makeConstraints { make in
            make.bottom.equalToSuperview().offset(-20)
            make.left.equalTo(topBox)
            make.top.equalTo(topBox.snp.bottom).offset(12)
        }
    }

}
